import { isFunction } from './isFunction'
import { mountComponent } from './mountComponent'
import { mountNativeElement } from './mountNativeElement'

export function mountElement (vdom, container, oldDom) {
  // 问题五：是组件元素还是普通元素(component vs nativeElement)
  if (isFunction(vdom)) {
    mountComponent(vdom, container, oldDom)
  } else {
    mountNativeElement(vdom, container, oldDom)
  }
}

/*
旧节点挂载元素
  - 普通vdom --- 创建dom元素 --- 挂载dom节点
  - 类或函数vdom --- 创建dom元素 --- 挂载dom节点
*/